<!--
 * @Author: 41
 * @Date: 2022-02-24 09:56:26
 * @LastEditors: YWY
 * @LastEditTime: 2022-03-03 17:16:28
 * @Description: 
-->
<template></template>

<script lang="ts">
import { defineComponent } from "vue";
import { useRouter } from "vue-router";
import { updateToken } from "../api/services/user.service";
export default defineComponent({
  name: "App",
  setup() {
    const gettoken = async () => {
      const router = useRouter();
      try {
        let res = await updateToken();
        console.log("oldtoken", res.result.oldtoken);
        console.log("newtoken", res.result.newtoken);
        window.localStorage.setItem(
          "Authorization",
          "Bearer " + res.result.newtoken
        );
        router.push("/home");
      } catch (err) {
        router.push("/login");
      }
    };
    gettoken();
  },
});
</script>